<?php
session_start();
include '../conn.php';
$uid = $_REQUEST['uid'];

$sql = "SELECT * FROM user WHERE id = '" . $uid . "'";
$result = $conn->query($sql);

if ($result->num_rows <= 0) {
    echo '请先注册或登录！';
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>上传头像</title>
  <link rel="stylesheet" type="text/css" href="../css/general.css">
  <link rel="stylesheet" type="text/css" href="../css/index.css">
  <script type="text/javascript" src="../js/jquery.js"></script>
  <script type="text/javascript" src="../js/general.js"></script>
  <script type="text/javascript" src="../js/carousel.js"></script>
  <style>
    /* 头部 */
    .header-body {
        background: url("../user/touxiang/background.jpg") no-repeat top center;
        background-size: cover;
        background-attachment: fixed;
        padding: 20px 0;
    }

    /* 容器 */
    .container {
        width: 1100px;
        margin: 0 auto;
        padding: 20px;
    }

    /* 表单样式 */
    .upload-form {
        max-width: 400px;
        margin: 0 auto;
        background-color: #fff;
        padding: 20px;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .upload-form label {
        display: block;
        margin-bottom: 10px;
        font-size: 18px;
        font-weight: bold;
    }

    .upload-form input[type="file"] {
        display: block;
        margin-bottom: 20px;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
    }

    .upload-form input[type="submit"] {
        display: block;
        width: 100%;
        padding: 10px;
        background-color: #1369C0;
        color: #fff;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background-color 0.3s;
    }

    .upload-form input[type="submit"]:hover {
        background-color: #0b4e8c;
    }
  </style>
</head>
<body>
<!-- 顶部开始 -->

<!-- 头部开始 -->
<div class="header-body">
    <!-- 头部开始 -->
    <?php include 'header.php'; ?>
    <!-- 头部结束 -->
</div>
<!-- 头部结束 -->
<!-- 主体开始 -->
<div class="container">
    <div class="upload-form">
        <form action="doupload.php?uid=<?php echo $uid;?>" name="form" method="post" enctype="multipart/form-data">
            <label for="file">选择文件：</label>
            <input type="file" name="file" id="file" required />
            <input type="submit" name="submit" value="上传" />
        </form>
    </div>
</div>
<!-- 主体结束 -->

<!-- 页脚开始 -->
<div style="margin-top:220px;"></div>
<?php include '../footer.php'; ?>
<!-- 页脚结束 -->

</body>
</html>